<?php
class Nhapxe_sksm extends Controller {
	private $data;
	
	function index() {		
		$this -> loadTools();
		$this -> loadData();
		$this -> load -> view('nhapxe/view_nhap_sksm',$this -> data );
	}
	
	function loadTools() {
		$this -> load -> helper('form');
		$this -> load -> helper('url');		
		$this -> load -> helper('My_utilities');
		$this -> load -> model('Xemay');
	}
	
	function loadData() {
		$this -> data['title'] = 'Nhap so khung / so may';
		$this -> data['so_luong'] = $_POST['so_luong'];		
		$realIndex = strval(((int)$_POST['loaixe'])-1);
		$this -> data['choosenItem'] = 			
			$this -> Xemay -> getNameWithId($realIndex) . '/'.
			$this -> Xemay -> getColorWithId($realIndex)
			;	
		$this -> data['gia_nhap'] = format_currency($_POST['gia_nhap']);
		//TO/DO: long ! be carefull - OK - Tested
		$this -> data['tong_cong'] = format_currency (((int)$_POST['gia_nhap']) * ((int)$_POST['so_luong']));
	}
}
	
?>